package com.neusoft.ysu.npms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neusoft.ysu.npms.mapper.*;
import com.neusoft.ysu.npms.pojo.Department;
import com.neusoft.ysu.npms.pojo.Result;
import com.neusoft.ysu.npms.pojo.Secondrisk;
import com.neusoft.ysu.npms.service.ISecondriskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者：刘金秋
 * @since 2024-06-18
 */
@Service
public class SecondriskServiceImpl extends ServiceImpl<SecondriskMapper,Secondrisk> implements ISecondriskService{

    @Autowired
    SecondriskMapper secondriskMapper;
    @Override
    public Result add(Secondrisk secondrisk) {
        return new Result<>(0, "", secondriskMapper.add(secondrisk));
    }

    @Override
    public Result deleteSrisk(Secondrisk secondrisk){
        return new Result<>(0,"",secondriskMapper.deleteSrisk(secondrisk));
    }
    @Override
    public Result updateSrisk(Secondrisk secondrisk){
        return new Result<>(0,"",secondriskMapper.updateSrisk(secondrisk));
    }
    @Override
    public Result selectAll(){
        return new Result<>(0,"",secondriskMapper.selectAll());
    }
    @Override
    public Result findById(Secondrisk secondrisk){
        return new Result<>(0,"",secondriskMapper.findById(secondrisk));
    }
    @Override
    public Integer findByName(Integer sriskid) {


//        QueryWrapper<Farmer> queryWrapper =new QueryWrapper<>();
//        queryWrapper.eq("name",farmer.getName());
//        Farmer farmer1 = farmerMapper.selectOne(queryWrapper);
//        System.out.println(farmer1.getFarmerid());
        return secondriskMapper.findByName(sriskid);
    }
}
